Generic Routing Encapsulation (GRE) is an encapsulation protocol which provides a mechanism for encapsulating a message of a protocol into a message following another protocol to realize transmission of the message in a heterogeneous network. In 1994, GRE was submitted to the Internet Engineering Task Force (IETF) by Cisco and Net Smiths, with labels of RFC1701 and RFC1702. In 2000, GRE was revised by Cisco, etc., and is named as GRE V2 with a label of RFC2784. At present, although RFC1701 is not a main standard to be followed, there still exists RFC1701-based equipment in an existing network.
At a message sender, a GRE tunnel encapsulates an original message and a GRE message header into a GRE message for “packaging” with a protocol message, and places the GRE message in a “data area” of an Internet Protocol (IP) message for transmission. After receiving the GRE message, a receiver performs decapsulation on the GRE message to recover the original message according to the format of the GRE message header. When the GRE message header is analyzed, there is no explicit field for identifying a length of the whole GRE message header in the GRE message header. If the message sender adopts RFC2784-based routing equipment, the length of the GRE message header may be 32 to 64 bits, and if the message receiver adopts RFC1701-based routing equipment, the length of the GRE message header may be 32 to 160 bits. The format and bit length of the GRE message header may not be unified, so that a corresponding field may not be correctly identified to analyze the complete message header, and routers may not be interconnected. Therefore, how to solve the problem has become an urgent technical problem.